export const model = {
  id: "",
  pid: "",
  permissionName: "",
  permissionType: 0,
  permissionCode: "",
  useStatus: 0,
  permissionDesc: "",
}

export const rules = {
  permissionName: [
    { required: true, message: '请输入资源名称', trigger: 'blur' },
  ],
  permissionCode: [
    { required: true, message: '请输入资源编码', trigger: 'blur' },
  ],
}

export const columns = [
  {
    title: "序号",
    dataIndex: "id",
    width: 70,
    align: "center",
    customRender: (text, record, index) => {
      return index + 1;
    },
  },
  {
    title: "资源名称",
    dataIndex: "permissionName",
    key: "permissionName",
    width: 120,
    align: "center",
  },
  {
    title: "资源编码",
    dataIndex: "permissionCode",
    key: "permissionCode",
    width: 70,
    align: "center",
  },
  {
    title: "资源类型",
    dataIndex: "permissionType",
    key: "permissionType",
    width: 70,
    align: "center",
    // eslint-disable-next-line no-unused-vars
    customRender: (t, r, i) => {
      if (t === 0) {
        return "目录";
      } else if (t === 1) {
        return "菜单";
      } else if (t === 2) {
        return "按钮";
      }
    },
  },
  {
    title: "使用状态",
    dataIndex: "useStatus",
    key: "useStatus",
    width: 70,
    align: "center",
    // eslint-disable-next-line no-unused-vars
    // customRender: (t, r, i) => {
    //   if (t === 0) {
    //     return "启用";
    //   } else {
    //     return "禁用";
    //   }
    // },
    scopedSlots: { customRender: "useStatus" },
  },
  {
    title: "资源描述",
    dataIndex: "permissionDesc",
    key: "permissionDesc",
    width: 120,
    align: "center",
  },
  {
    title: "创建人",
    dataIndex: "createBy",
    key: "createBy",
    width: 80,
    align: "center",
  },
  {
    title: "创建时间",
    dataIndex: "createTime",
    key: "createTime",
    width: 120,
    align: "center",
  },
  {
    title: "操作",
    key: "action",
    width: 150,
    fixed: 'right',
    align: "center",
    scopedSlots: { customRender: "action" },
  },
];